package me.leiusual.sharing.ui.product

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.FragmentScope
import me.leiusual.sharing.di.ViewModelKey
import me.leiusual.sharing.ui.product.dialog.ProductOptionalDialog
import me.leiusual.sharing.ui.product.dialog.ProductOptionalViewModel

/**
 * author: leiusual
 * create on: 2019-07-26
 * description:
 */
@Module
abstract class ProductModule {

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun productOptionalDialog(): ProductOptionalDialog

  @Binds
  @IntoMap
  @ViewModelKey(ProductOptionalViewModel::class)
  abstract fun productOptionalViewModel(productOptionalViewModel: ProductOptionalViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun productDetailFragment(): ProductDetailFragment

  @Binds
  @IntoMap
  @ViewModelKey(ProductDetailViewModel::class)
  abstract fun productDetailViewModel(productDetailViewModel: ProductDetailViewModel): ViewModel
}